package edu.scnu.fans.fingertip.common.api;

import java.util.Collection;
import java.util.Collections;
import java.util.Map;

/**
 * 返回对象工具类
 */
public class ResponseUtils {

	private ResponseUtils() {
	}

	/**
	 * 返回对象
	 * 
	 */
	public static <T> ApiResponse<T> data(T data) {
		return new ApiResponse<T>(data);
	}

	/**
	 * 返回列表清单
	 */
	public static <T extends Collection<?>> RowResponse<T> rows(T rows) {
		return new RowResponse<>(rows);
	}


	/** 空对象 */
	public static final ApiResponse<Map<String, Object>> EMPTY = new ApiResponse<Map<String, Object>>(Collections.emptyMap()) {

		@Override
		public Map<String, Object> getData() {
			return Collections.emptyMap();
		}

	};
	
}
